<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加品牌</title>
</head>
<body>
<h3>添加品牌</h3>
<form action="" method="post">
  品牌名称：<input id="brandName" name="brandName"><br>
  企业名称：<input id="companyName" name="companyName"><br>
  排序：<input id="ordered" name="ordered"><br>
  描述信息：<textarea rows="5" cols="20" id="description" name="description"></textarea><br>
  状态：
  <input type="radio" name="status" value="0">禁用
  <input type="radio" name="status" value="1">启用<br>

  <input type="button" id="btn"  value="提交" onclick="sub()">
</form>
</body>
</html>
<script src="js/jquery-3.7.1.js"></script>
    <script>
        function sub() {
            var brandName = $("#brandName").val();
            var companyName = $("#companyName").val();
            var ordered = $("#ordered").val();
            var description = $("#description").val();
            var status = $("input[name='status']:checked").val()
            $.ajax({
                url:"addBrandServlet",
                type:"POST",
                data:{
                    brandName: brandName,
                    companyName: companyName,
                    ordered: ordered,
                    description: description,
                    status: status
                },
                success:function (data) {
                    window.location.href='brand.jsp';
                }
            })
        }

    </script>